<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt"  uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <!--公共样式-->
    <link href="${pageContext.request.contextPath }/web/css/font/iconfont.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/web/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/NormalizeFile.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/public.css" />
    <!--列表页面私有样式-->
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/web/css/subpage/person.css" />
</head>
<body class="w928">
    <!--用户中心 begin-->
        <!--我的订单-->
        <div class="right-content bor1 font1">
            <div class="bor1-t xx-top"><spring:message code="member.myShoppingCart.cart"></spring:message>
            </div>
            <div class="bor1-t order-detail-content">
              
                <div class="order-wei">
                    <div class="order-top bor1 bor-t0 h50 line-h50 detail-or-top">
                        <span class="w33"><spring:message code="member.myShoppingCart.product"></spring:message></span>
                        <span class="w13"><spring:message code="member.myShoppingCart.length"></spring:message></span>
                        <span class="w13"><spring:message code="member.myShoppingCart.price"></spring:message></span>
                        <span class="w13"><spring:message code="member.myShoppingCart.sum"></spring:message></span>
                        <span class="w13"><spring:message code="member.myShoppingCart.classify"></spring:message></span>
                        <span class="w13"><spring:message code="member.myShoppingCart.operate"></spring:message></span>
                    </div>
                    <div class="order-content-wei">
                        <div class="or-detail">
                            <ul>
                                <c:forEach items="${list}" var="item">
                                <li>
                                    <div class="w33">
                                        <div class="check-sel"><input class="f-l" value="${item.SC_ID}" onclick="mani()" mani="${item.SC_TOTAL_PRICE}" type="checkbox" /></span>
                                        <div class="or8">
                                         <c:choose>
										<c:when test="${item.SC_TYPE!='3'}">
						                 <a target="_top" href="${pageContext.request.contextPath}/web/patternfilter/viewpattern?pNo=${item.SC_PATTERN_NO}"><img src="${item.SC_PATTERN_IMG}" /></a>
						                </c:when>
						                <c:when test="${item.SC_TYPE=='3'}">
						                <a target="_top" href="${pageContext.request.contextPath}/web/patternfilter/viewf?fNo=${item.SC_FABRIC_NO}"><img src="${pageContext.request.contextPath }/upload/${item.SC_FABRIC_COLOR}" /></a>
						             </c:when>
						             <c:otherwise>
						               <img src="${pageContext.request.contextPath }/web/img/bl2.jpg" />
						             </c:otherwise>
						             </c:choose>
                                        </div>
                                        <div class="or7">
	                                        <c:choose>
												<c:when test="${item.SC_TYPE==0}">
												 <p class="zichang" style="line-height: 48px"><spring:message code="member.myShoppingCart.flower"></spring:message><span title="${item.SC_PATTERN_NO}">${item.SC_PATTERN_NO}</span>
			                                       <br/> <span title="${item.PP_NAME } ">${item.PP_NAME }</span>
												</c:when>
												<c:when test="${item.SC_TYPE==1}">
												 <p class="zichang" style="line-height:100px"><spring:message code="member.myShoppingCart.flower"></spring:message><span title="${item.SC_PATTERN_NO}">${item.SC_PATTERN_NO}</span>
			                                            
												</c:when>
												<c:when test="${item.SC_TYPE==2}">
												 <p class="zichang" style="line-height: 35px"><spring:message code="member.myShoppingCart.flower"></spring:message><span title="${item.SC_PATTERN_NO}">${item.SC_PATTERN_NO}</span>
			                                            <br/>
			                                               	 <spring:message code="member.myShoppingCart.fabric"></spring:message>${item.SC_FABRIC_NO}
			                                               	 <br><span title="${item.PP_NAME }">${item.PP_NAME }</span>
												</c:when>
												<c:when test="${item.SC_TYPE==3}">
												 <p class="zichang" style="line-height: 100px">
			                                               	<spring:message code="member.myShoppingCart.fabric"></spring:message><span title="${item.SC_FABRIC_NO}">${item.SC_FABRIC_NO}</span>
												</c:when>
											</c:choose> 
                                           
                                            </p>
                                        </div>
                                    </div>
                                    </div>
                                    <div class="w13">
                                      ${item.SC_FABRIC_SIZE}
                                    </div>
                                    <div class="w13">
                                       	 ￥${item.SC_PATTERN_SINGLE_PRICE }
                                    </div>
                                    <div class="w13">
                                	        ￥${item.SC_TOTAL_PRICE}
                                    </div>
                                    <div class="w13">
	                                    <c:choose>
											<c:when test="${item.SC_TYPE==0}">
											<spring:message code="member.myShoppingCart.printing"></spring:message>
												
											</c:when>
											<c:when test="${item.SC_TYPE==1}">
											<spring:message code="member.myShoppingCart.buyout"></spring:message>
										
											</c:when>
											<c:when test="${item.SC_TYPE==2}">
											<spring:message code="member.myShoppingCart.endProduct"></spring:message>
												
											</c:when>
											<c:when test="${item.SC_TYPE==3}">
											<spring:message code="member.myShoppingCart.ml"></spring:message>
											</c:when>
										</c:choose> 
                                    </div>
                                    <div class="w13">
                                       <a href="javascript:yichu(${item.SC_ID})" class="a-remove"><spring:message code="member.myShoppingCart.remove"></spring:message></a>
                                    </div>
                                </li>
                                </c:forEach>
                            </ul>
                        </div>
                    </div>
                </div>

                <p class="real-pay">
                    <spring:message code="member.myShoppingCart.hj"></spring:message>￥<span id="mani">0</span>
                    <input onclick="ordergenerated()" type="button" class="btn-red" value='<spring:message code="member.myShoppingCart.qjs"></spring:message>' style="margin-left:20px;" />
                </p>

            </div>
        </div>
        <form id="mai"  target="_top"   action="${pageContext.request.contextPath }/web/orders/caraccount" method="post">
        <input type="hidden" name="oId" id="oId">
        </form>
    <!--用户中心 end-->
    <!--全局-->
    <script type="text/javascript" src="${pageContext.request.contextPath }/web/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath }/web/js/public.js"></script>
    <!--ie789下placeholder不兼容-->
    <script type="text/javascript" src="${pageContext.request.contextPath }/web/js/placeholder.js"></script>
    <!--头部的以图搜图-->
    <%-- <script type="text/javascript" src="${pageContext.request.contextPath }/web/js/uppicFile.js"></script> --%>
    <script type="text/javascript">
    function yichu(id){
    	 window.parent.layer.confirm('<spring:message code="reciveAddress.confirmDeletion"></spring:message>', {
         	  btn: ['<spring:message code="reciveAddress.confirm"></spring:message>','<spring:message code="reciveAddress.cancel"></spring:message>'], //按钮
         	  title:'<spring:message code="reciveAddress.message"></spring:message>'
         	}, function(index){
         		$.ajax({
         	   		 url:'${pageContext.request.contextPath }/web/shoppingcart/delshoppingcart',
         	   		 async : false,
         	   		 data: {scId:id},
         	   		 type : "POST", 
         	   		 success :function(result){
         	   		 var status=result.msg.status;
         	   		 var desc=result.msg.desc;
         	   		 if(status == 0){
         	   			 window.parent.parent.layer.msg("<spring:message code='caozuochenggong'></spring:message>", {icon: 1,time: 1000}); 
         	   			 location.reload(true);
         	   		 }else if(status == 2){//没登录
         	   			 window.parent.parent.layer.msg("<spring:message code='weidenglu'></spring:message>", {icon: 0,time: 1000}); 
         	   		    }else if(status ==1){//失败
         	   		    	 window.parent.parent.layer.msg("<spring:message code='caozuoshibai'></spring:message>", {icon: 0,time: 1000}); 
         	   		    }
         	   		 }
         	   		 });
         	},function(index){
         		 window.parent.layer.close(index);
         	});
    	
    	
    
    }
   function mani() {
    	var count = 0;
    	$("input[type=checkbox]").each(function(){
    		if($(this).attr("checked") == "checked"){
    			count = $(this).attr("mani")-0+count;
    		}
    	});
    	$("#mani").text(count.toFixed(2));
    }
function ordergenerated(){
    	
    	var searchVals=[];
    	$("input[type=checkbox]").each(function(){
    		if($(this).attr("checked") == "checked"){
    			searchVals.push($(this).val());
    		}
    	});
    	if(searchVals.length==0){
    		 window.parent.parent.layer.msg('<spring:message code="reciveAddress.choose"></spring:message>', {icon: 0,time: 1000});
    		 return;
    	}
    	$.ajax({
      		 url:'${pageContext.request.contextPath }/web/orders/look',
      		 async : false,
      		 traditional:true,
      		 data: {"oId":searchVals},
      		 type : "POST", 
      		 success :function(result){
      		 var status=result.msg.status;
      		 var desc=result.msg.desc;
      		 if(status == 0){
      			 $("#oId").val(searchVals);
      			 $("#mai").submit();
      		 }else if(status ==1){//失败
      		    	 window.parent.parent.layer.msg('<spring:message code="huaxingyibeimaiduan"></spring:message>', {icon: 0,time: 1000}); 
      		    }
      		 }
      		 });
    }
    </script>
</body>
</html>